package com.zznj.xzjc.adapter.index;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;

import java.util.List;

import androidx.annotation.Nullable;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class SelectDictionaryAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public SelectDictionaryAdapter(int layoutResId, @Nullable List<String> data) {
        super(layoutResId, data);
    }

    private int selectPosition = -1;
    public void setSelectPosition(int position){
        this.selectPosition = position;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.content, item);
        TextView content = helper.getView(R.id.content);
        content.setText(item);
        if(helper.getAdapterPosition() == selectPosition){
            content.setTextColor(mContext.getResources().getColor(R.color.tab_menu_text_select));
        }else{
            content.setTextColor(mContext.getResources().getColor(R.color.color_333333));
        }
    }
}
